PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

How to implement $.fn

Solved
ngatsejacques

Oct 4th, 2022 01:57 PM

Hi, I want to implement a jquery plugin but i got errors each times The plugin is https://alexemashev.github.io/lsb-lightbox/ And the script is '$.fn.lightspeedBox();' but i got an error each time i load the web page Anyone can help me ?

bobbyiliev

Oct 5th, 2022 03:40 AM

Hi there,

I've noticed that this plugin seems abandoned, it has not been updated in the last 3 years. So I've tested it with jQuery v2.x and it works, where as with jQuery v3.x it was failing with:

Uncaught TypeError: url.indexOf is not a function
    at jQuery.fn.load (jquery-3.6.1.js:10389:13)

What is the error that you are getting?

ngatsejacques

Oct 5th, 2022 04:09 AM

Thank you for your answer I get "i(...).fn.lightspeedBox is not a function" But i forgot about jQuery compatibility. when i try to init it in app.js

Maybe you know a plugin or where i can find a plugin that can do lightbox and specially download button, i want to allow my user to download auto generated images with one plugin

bobbyiliev

Oct 5th, 2022 06:38 AM

Hi there,

One option is to include jQuery and the lightbox plugin via their CDNs on the specific view that you need them on.

Alternatively, you could use the following lightbox implementation with Alpine and Tailwind CSS:

https://tailwindcomponents.com/component/alpinejs-tailwindcss-lightbox-modal

And implement a download button with pure JavaScript, eg:

// Using fetch
async function downloadImage(imageSrc) {
  const image = await fetch(imageSrc)
  const imageBlog = await image.blob()
  const imageURL = URL.createObjectURL(imageBlog)

  const link = document.createElement('a')
  link.href = imageURL
  link.download = 'image file name here'
  document.body.appendChild(link)
  link.click()
  document.body.removeChild(link)
}

Let me know how it goes!

ngatsejacques

Oct 6th, 2022 02:39 AM

Best Answer

Hi,

Finally i followed your suggestion about the jQuery version and found a new tool that do the job it's called VenoBox. https://veno.es/venobox/

Here is a screen of my AI autogenerated image

Capture d’écran 2022-10-06 à 11.36.27-min.jpg

Report
1
bobbyiliev

Oct 6th, 2022 11:42 PM

That is great! Happy to hear that you've got it working with that new tool, looks great!